# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         fromkeys方法
# Description:
# Author:       asus
# Date:         2019/3/6
#-------------------------------------------------------------------------------


#在一个空字典上调用fromkeys方法创建一个新字典，通过列表指定key
newdict1 = {}.fromkeys(['name','company','salary'])
print(newdict1)
#在newdict1上调用fromkey方法船舰一个新字典（newdict2），通过元组指定key
newdict2 = newdict1.fromkeys(('name','company','salary'))
print(newdict2)
#通过fromkey方法的第2个参数指定key的默认值，通过列表指定
newdict3 = newdict1.fromkeys(('name','company','salary'),"没有值")
print(newdict3)